package org.example.examsystem.service;



import org.example.examsystem.entity.User;
import org.example.examsystem.mapper.UserMapper;
import org.example.examsystem.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {


    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUserByUsernameAndPassword(String username, String password) {
        return userMapper.findUserByUsernameAndPassword(username, password);
    }

    @Override
    public int registerUser(User user) {
        return userMapper.registerUser(user);
    }

    @Override
    public User findUserById(int userId) {
        return userMapper.findUserById(userId);
    }

    @Override
    public int updatePassword(int userId, String newPassword) {
        return userMapper.updatePassword(userId, newPassword);
    }

}